package io.renren;

import com.lc.ibps.grpc.examples.lib.HelloReply;
import com.lc.ibps.grpc.examples.lib.HelloRequest;
import com.lc.ibps.grpc.examples.lib.MyServiceGrpc;
import io.grpc.stub.StreamObserver;
import net.devh.boot.grpc.server.service.GrpcService;

/**
 * 使用插件protobuf编译不能生成MyServiceGrpc类 需要执行mvn clean install命令
 * @author zhuguanming
 * @description: myservice impl
 * @date 2022/2/11 17:12
 **/
@GrpcService
public class MyServiceImpl extends MyServiceGrpc.MyServiceImplBase {

    @Override
    public void sayHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) {
        HelloReply reply = HelloReply.newBuilder().setMessage("Hello ==> " + req.getName()).build();
        responseObserver.onNext(reply);
        responseObserver.onCompleted();
    }

}
